1. Field of the Invention
The present invention relates to software, and more specifically to a method and apparatus to generate an executable file from program files when some of the program files expressly incorporate other program files.
2. Related Art
A program file is typically represented as text containing a list of instructions in a programming language. Large program files may be split into a number of smaller program files for separating functionality, providing modularity and/or for ease of usage, as is well understood in the relevant arts.
In general, instructions are provided by the programming language using which program files can be expressly incorporated into one another—thereby effectively designed for operation as one large program file. For convenience, the file incorporating another file is referred to as an “incorporating file” and the file being incorporated is referred to as an “incorporated file”.
An example of such a programming language is C programming language where large program files can be split into header and source files. The C programming language provides a construct “#include <filename>” by which one header or source file can expressly incorporate another header or source file. Typically, source files ending with extension “.c” incorporate header files ending with extension “.h”.
Program files need to be converted into an executable file before they can be executed by the underlying hardware. The executable file generally contains instructions (typically in binary form) suitable for execution by the processors contained in the hardware.
The process of generating an executable file from program files typically consists of converting (or compiling) each program file into a compiled file using a compiler of the programming language and then building the executable file from the compiled files. Building generally entails linking the compiled filed into an executable file noted above.
Typically, an executable file is generated from a large number of program files. As such, a change made in one of the program files may necessitate the recompilation of all the program files, which is not desirable. Various approaches have been proposed for increasing the efficiency of generating an executable file from program files.
In one prior approach, a program file is recompiled only when the modification date of a program file (as maintained by the underlying operating system) is more recent than the modification date of its corresponding compiled file. Such an approach is used in utilities such as ‘make’ and ‘gmake’ well known in Unix type environments and ‘nmake’ well known in Windows type environments.
One disadvantage with such an approach is that consideration of modification date alone may not lead to efficient generation of accurate executable file since incorporating files need to be recompiled if the incorporated files are modified. Various aspects of the present invention overcome such deficiencies as described in sections below.
What is therefore needed is an approach, which enables the efficient generation of an executable file from program files while addressing one or more problems/requirements described above.
In the drawings, like reference numbers generally indicate identical, functionally similar, and/or structurally similar elements. The drawing in which an element first appears is indicated by the leftmost digit(s) in the corresponding reference number.